<template>
  <el-dialog :title="title" :close-on-click-modal="false" :fullscreen="true" :visible.sync="visible"
    :before-close="cancel" class="JNPF-dialog JNPF-dialog_center" lock-scroll width="50%">
    <el-row class="JNPF-common-search-box" :gutter="16">
      <el-form @submit.native.prevent ref="elForm" :model="dataForm" :rules="rules">
        <el-col :span="8">
          <el-form-item label="单号" prop="FBILLNO">
            <el-input v-model="dataForm.FBILLNO"  disabled />
          </el-form-item>
        </el-col>

        <el-col :span="8">
          <el-form-item label="日期" prop="FBILLCREDATE" >
            <el-date-picker v-model="dataForm.FBILLCREDATE" value-format="yyyy-MM-DD" type="date" placeholder="选择日期" disabled>
            </el-date-picker>
          </el-form-item>
        </el-col>

        <el-col :span="8">
            <el-form-item label="状态">
              <el-select v-model="dataForm.FBILLSTATE" placeholder="请选择" disabled>
                <el-option
                  v-for="item in options1"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>

        <el-col :span="8">
          <el-form-item label="巡查人员" prop="FUSER" >
            <el-input v-model="dataForm.FUSER"   disabled/>
          </el-form-item>
        </el-col>

        <el-col :span="8">
          <el-form-item label="巡查线路" prop="FLINENAME" >
            <el-input v-model="dataForm.FLINENAME"  disabled />
          </el-form-item>
        </el-col>

        <el-col :span="8">
          <el-form-item label="场地名称" prop="FPOINT" >
            <el-input v-model="dataForm.FPOINT" disabled  />
          </el-form-item>
        </el-col>

        <el-col :span="8">
          <el-form-item label="开始时间" prop="FBEGTIME" >
            <el-input v-model="dataForm.FBEGTIME" disabled  />
          </el-form-item>
        </el-col>

        <el-col :span="8">
          <el-form-item label="结束时间" prop="FENDTIME" >
            <el-input v-model="dataForm.FENDTIME" disabled  />
          </el-form-item>
        </el-col>

        <el-col :span="8">
          <el-form-item label="巡查计划" prop="FSRCNO" >
            <el-input v-model="dataForm.FSRCNO" disabled  />
          </el-form-item>
        </el-col>

        <el-col :span="16">
          <el-form-item label="巡查备注" prop="FMEMO" >
            <el-input v-model="dataForm.FMEMO"   />
          </el-form-item>
        </el-col>
        
        <el-col :span="5">
          <el-form-item label="">
            <!-- <el-button type="success" icon="el-icon-plus" @click="insert">添加场地</el-button> -->
            <el-button type="primary" :loading="loading">返回</el-button>
          </el-form-item>
        </el-col>
      </el-form>
    </el-row>

    <template>
     <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
      <el-tab-pane label="PP通风柜-1" name="first">
        <el-table :data="list1" border stripe>
          <el-table-column label="操作" width="80">
            <template slot-scope="scope">
              <el-button slot="reference" icon="el-icon-delete" style="color: red" @click="shopdate(scope.$index)"
                type="text">删除</el-button>
            </template>
          </el-table-column>
          <el-table-column prop="FENTRYID" label="序号" width="75"></el-table-column>
          <el-table-column prop="FITEM01" label="巡查项目" width="125"></el-table-column>
          <el-table-column prop="FITEM02" label="巡检内容" ></el-table-column>
          <el-table-column prop="FITEM03" label="巡查结果"></el-table-column>
          <el-table-column prop="FTIME" label="巡查时间" width="155"></el-table-column>
          <el-table-column prop="FIMAGE" label="巡查照片" width="155"></el-table-column>
       </el-table>
      </el-tab-pane>

      <el-tab-pane label="PP通风柜-2" name="second">
        <el-table :data="list1" border stripe>
          <el-table-column label="操作" width="80">
            <template slot-scope="scope">
              <el-button slot="reference" icon="el-icon-delete" style="color: red" @click="shopdate(scope.$index)"
                type="text">删除</el-button>
            </template>
          </el-table-column>
          <el-table-column prop="FENTRYID" label="序号" width="75"></el-table-column>
          <el-table-column prop="FITEM01" label="巡查项目" width="125"></el-table-column>
          <el-table-column prop="FITEM02" label="巡检内容" ></el-table-column>
          <el-table-column prop="FITEM03" label="巡查结果"></el-table-column>
          <el-table-column prop="FTIME" label="巡查时间" width="155"></el-table-column>
          <el-table-column prop="FIMAGE" label="巡查照片" width="155"></el-table-column>
       </el-table>
      </el-tab-pane>
      
      <el-tab-pane label="PP试验台-1" name="third">
        <el-table :data="list3" border stripe>
          <el-table-column label="操作" width="80">
            <template slot-scope="scope">
              <el-button slot="reference" icon="el-icon-delete" style="color: red" @click="shopdate(scope.$index)"
                type="text">删除</el-button>
            </template>
          </el-table-column>
          <el-table-column prop="FENTRYID" label="序号" width="75"></el-table-column>
          <el-table-column prop="FITEM01" label="巡查项目" width="125"></el-table-column>
          <el-table-column prop="FITEM02" label="巡检内容" ></el-table-column>
          <el-table-column prop="FITEM03" label="巡查结果"></el-table-column>
          <el-table-column prop="FTIME" label="巡查时间" width="155"></el-table-column>
          <el-table-column prop="FIMAGE" label="巡查照片" width="155"></el-table-column>
       </el-table>
      </el-tab-pane>

      <el-tab-pane label="PP试验台-2" name="fourth">
        <el-table :data="list3" border stripe>
          <el-table-column label="操作" width="80">
            <template slot-scope="scope">
              <el-button slot="reference" icon="el-icon-delete" style="color: red" @click="shopdate(scope.$index)"
                type="text">删除</el-button>
            </template>
          </el-table-column>
          <el-table-column prop="FENTRYID" label="序号" width="75"></el-table-column>
          <el-table-column prop="FITEM01" label="巡查项目" width="125"></el-table-column>
          <el-table-column prop="FITEM02" label="巡检内容" ></el-table-column>
          <el-table-column prop="FITEM03" label="巡查结果"></el-table-column>
          <el-table-column prop="FTIME" label="巡查时间" width="155"></el-table-column>
          <el-table-column prop="FIMAGE" label="巡查照片" width="155"></el-table-column>
       </el-table>
      </el-tab-pane>

    </el-tabs>
  </template>

    <StudqueryFcuston ref="StudqueryFcuston" @confirm="shoplist" />
  </el-dialog>
</template>
<script>
  import StudqueryFcuston from "@/components/StudqueryFcuston/StudqueryFcuston.vue"
  import jnpf from "@/utils/jnpf"
  export default {
    components: { StudqueryFcuston },
    props: {
      formationlist: {
        type: Array,
        default: [],
      },
    },
    data() {
      return {
        activeName: 'first',
        title: "新增",
        insertorupdate: true,
        dataForm: {
            FBILLNO: "X24120001", 
            FBILLCREDATE:"2024-12-29",
            FUSER: "王莽",
            FLINENAME: "巡查1路",
            FPOINT:"1教楼101教室",
            FBEGTIME:"18:00",
            FENDTIME:"20:00",
            FMEMO: "每天执行并上报",
            FSRCNO:"K241130001",
            FCHECKUSE: "",
            FCHECKDATE: "",
            FBILLTYPE:"日巡查",
            FBILLSTATE: "已完成"
        },
        rules: {
          FMEMO: [
            { required: true, message: '请输入巡查备注', trigger: 'blur' },
          ],
        },
        list1: [{  "FENTRYID":1,
                  "FITEM01": "外观检查",
                  "FITEM02": "设备外观是否完好，有无损坏、锈蚀等现象",
                  "FITEM03": "完好",
                  "FMEMO": "",
                  "FTIME":"2024-12-01 18:05:00",
                  "FIMAGE":""
                },
                { "FENTRYID":2,
                  "FITEM01": "运行状态",
                  "FITEM02": "设备运行是否平稳，有无异响、振动等异常情况",
                  "FITEM03": "异响",
                  "FMEMO": "时断时续",
                  "FTIME":"2024-12-01 18:05:00",
                  "FIMAGE":""
                },
                { "FENTRYID":3,
                  "FITEM01": "电气系统",
                  "FITEM02": "检查电线电缆是否完好，接线是否牢固，电器元件是否正常工作",
                  "FITEM03": "完好",
                  "FMEMO": "",
                  "FTIME":"2024-12-01 18:05:00",
                  "FIMAGE":""
                },
                { "FENTRYID":4,
                  "FITEM01": "润滑系统",
                  "FITEM02": "检查设备润滑部位是否缺油，润滑油脂是否清洁、适量",
                  "FITEM03": "缺油",
                  "FMEMO": "需要加油",
                  "FTIME":"2024-12-01 18:05:00",
                  "FIMAGE":""
                },
                { "FENTRYID":5,
                  "FITEM01": "安全防护",
                  "FITEM02": "检查设备的安全防护装置是否完好，操作是否灵活",
                  "FITEM03": "完好",
                  "FMEMO": "",
                  "FTIME":"2024-12-01 18:05:00",
                  "FIMAGE":""
                }],
        list3: [{  "FENTRYID":1,
                  "FITEM01": "外观检查",
                  "FITEM02": "台面干净整洁",
                  "FITEM03": "干净",
                  "FMEMO": "",
                  "FTIME":"2024-12-01 18:05:00",
                  "FIMAGE":""
                },
                { "FENTRYID":2,
                  "FITEM01": "运行状态",
                  "FITEM02": "设备排放整齐，合理",
                  "FITEM03": "正常",
                  "FMEMO": "",
                  "FTIME":"2024-12-01 18:05:00",
                  "FIMAGE":""
                }],
        loading: false,
        visible: false,

        //所属校区选择数据
        options1: [{
          value: '1',
          label: '申请中'
        }, {
          value: '2',
          label: '已通过'
        }, {
          value: '3',
          label: '已驳回'
        }],

        //所属校区选择数据
        options2: [{
          value: '1',
          label: '教学申请'
        }, {
          value: '2',
          label: '培训人员'
        }, {
          value: '3',
          label: '外来人员'
        }],
        
      };
    },
    created() {
    },
    mounted() { },
    methods: {
      //
      init(FBILLNO) {
        this.dataForm.FBILLNO = FBILLNO;
        if (this.dataForm.FBILLNO) {
          this.title = "修改"
          this.insertorupdate = false;
        }
        else {
          this.title = "新增"
          this.dataForm.FBILLNO = "K" + Math.floor(Math.random() * 10000000) + 1;
          this.insertorupdate = true;
        }
        this.visible = true;
      },
      insert() {
        this.$refs.StudqueryFcuston.open();
      },
      shoplist(data) {
        data.forEach(item => {
          this.list.push({
            FBILLNO: this.dataForm.FBILLNO
            , FENTRYID: "1"
            , FYEAR: 2024
            , FGRADE: "大一"
            , FCLASS: "化学系1班"
            , FSTUDNAME: "曹操"
          },{
            FBILLNO: this.dataForm.FBILLNO
            , FENTRYID: "2"
            , FYEAR: 2024
            , FGRADE: "大一"
            , FCLASS: "化学系1班"
            , FSTUDNAME: "刘备"
          })
        });
      },
      //
      cancel() {
        this.$refs.elForm.resetFields();
        this.list = [];
        this.visible = false;
      },
    },
  };
</script>